<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://www.rapid-framework.org.cn/rapid" prefix="rapid" %>
<%@ page import="com.rcm.model.*" %>
<script type="text/javascript">
function goPage(num){
	
	location.href="http://localhost:8080/ElectiveSystem/Teacherinfocontroller/studentlist?pageNum="+num;
}
</script>
<rapid:override name="head">
    <title>学生管理</title>
</rapid:override>
<rapid:override name="content">
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    %>

      <p style="color:red; margin-top:10px; font-size:15px;">${msg}</p>
    <div style="height:500px">
    <table class="layui-table" style="margin-top:15px;">
        <colgroup>
         
         
        </colgroup>
        <div >
    		<form  action="${pageContext.request.contextPath}/Teacherinfocontroller/Addstudent" method="post"> 
    		<input type="text" class="layui-input" name="sid"  placeholder="请输入学生学号" style="width:180px" >
    		<input type="text" class="layui-input" name="name"  placeholder="请输入学生姓名" style="width:180px" >
    		<input type="text" class="layui-input" name="password"  placeholder="请输入登录密码" style="width:180px" >
    		<input type="text" class="layui-input" name="email"  placeholder="请输入邮箱账号" style="width:180px" >
    		<input class="layui-btn layui-btn layui-btn-lg"    type="submit" value="添加">
 
    		 </form>
    		 <div style="float:right">
    		
    		 <form action="${pageContext.request.contextPath}/Teacherinfocontroller/querystudent" method="post"> 
    		
    		
    		<select class="layui-select" name="param">
    			<option value="学号">学号</option>
    			<option value="姓名">姓名</option>
    		<!--  <option value="密码">密码</option>-->
    			<option value="邮箱">邮箱</option>
    			<option value="班级">班级</option>
    			<option value="年龄">年龄</option>
    		</select>
    		<input type="text" class="layui-input" name="search"  placeholder="请输入搜索内容" style="width:180px" >
    		<input class="layui-btn layui-btn-danger layui-btn-lg" type="submit" value="搜索">
    		
    		 </form>
  </div>
    		
        </div>
        <thead>
        <tr>
            <th>学生学号</th>
            <th>学生姓名</th>
	        <th>登录密码</th>
            <th>邮箱账号</th>
            <th>班级</th>
            <th>年龄</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${pageInfo.list}" var="c">
            <tr>
                <td>${c.sid}</td>
                <td>${c.name}</td>
                <td>********</td>
             <!--   <td>${c.password}</td> --> 
                <td>${c.email}</td>
                <td>${c.gradeclass}</td>
			    <td>${c.age}</td>
 				 <td><a href="${pageContext.request.contextPath}/Teacherinfocontroller/deletestudent?sid=${c.sid}" style="color: #000;" onclick="javascropt:return confirm('确定要删除吗？');">删除&nbsp;&nbsp;</a> 
 				      <a href="${pageContext.request.contextPath}/Teacherinfocontroller/update?sid=${c.sid}" style="color: #000;"> 修改 </a>
 				 </td>
       
            </tr>
        </c:forEach>
        </tbody>
    </table>
    </div>
   
<%-- <c:forEach begin="1"  end="${pageInfo.pages}"  var="i" step="1">
	<input type="button" value="${i}">
	    <p style=" color: black; font-size:16px; margin-bottom:10px;">当前第 ${pageInfo.pageNum}
                页/共 ${pageInfo.pages} 页</p>
 <button class="layui-btn layui-btn-disabled" onclick="goPage(${pageInfo.pages+1})">下一页</button>
	

</c:forEach> --%>

  <div style="text-align:center; margin-top:10px; margin-left:-100px;">
        <c:if test="${pageInfo.total>=0}">
            <p style=" color: black; font-size:16px; margin-bottom:10px;">当前第 ${pageInfo.pageNum}
                页/共 ${pageInfo.pages} 页</p>
            <c:choose>
         		 <c:when test="${pageInfo.pageNum==1}">
                    <button class="layui-btn layui-btn-disabled" >首页</button>
                    <button class="layui-btn layui-btn-disabled" >上一页</button>
                    <button class="layui-btn " onclick="goPage(${pageInfo.pageNum+1})">下一页</button>
                    <button class="layui-btn " onclick="goPage(${pageInfo.pages})">末页</button>
                </c:when>
                 <c:when test="${pageInfo.pageNum>=1 && pageInfo.pageNum<pageInfo.pages}">
                    <button class="layui-btn " onclick="goPage(1)">首页</button>
                    <button  class="layui-btn " onclick="goPage(${pageInfo.pageNum-1})">上一页</button>
                    <button class="layui-btn "onclick="goPage(${pageInfo.pageNum+1})">下一页</button>
                    <button class="layui-btn " onclick="goPage(${pageInfo.pages})">末页</button>
                </c:when>
                 <c:when test="${pageInfo.pages==1}">
                    <button class="layui-btn layui-btn-disabled" >首页</button>
                    <button  class="layui-btn layui-btn-disabled" ">上一页</button>
                    <button class="layui-btn layui-btn-disabled">下一页</button>
                    <button class="layui-btn layui-btn-disabled" >末页</button>
                </c:when>
                      
                
                 <c:when test="${pageInfo.pageNum==pageInfo.pages && pageInfo.pages>=1}">
                    <button class="layui-btn " onclick="goPage(1)">首页</button>
                    <button  class="layui-btn " onclick="goPage(${pageInfo.pageNum-1})">上一页</button>
                    <button class="layui-btn layui-btn-disabled">下一页</button>
                    <button class="layui-btn layui-btn-disabled" >末页</button>
                </c:when>
                
            </c:choose>
        </c:if>
        
    </div>



</rapid:override>


<%@ include file="baseteacher.jsp" %>
